<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="">
    <meta http-equiv="x-dns-prefetch-control" content="on">

    <title>车费预估</title>
    <link href="../../css/css.css" rel="stylesheet" type="text/css">
    <script src="../../js/jquery-v1.11.2.min.js"></script>
    <script src="../../js/common.js"></script>
    <script src="../../js/customer.js"></script>
</head>
<body>
 <form id="orderForm" name="orderForm" method="post">
 <div id="estimateInfo">
 
 </div>
<!-- <section class="itemgroup mt10">
    <div class="estimateitem p15">
        <div class="gray left">预估费用</div>
        <div class="right orange"><font class="bigtext">128</font>元</div>
    </div>
</section>
<section class="sale_info">实际费用可能因实际行驶里程/等候时间等因素差异</section>
<section class="itemgroup mt10 p15 mb56">
    <div class="oneitem">
        <div class="gray left">总计行驶:</div>
        <div class="right"><label class="mr5">55</label>公里</div>
    </div>
    <div class="oneitem">
        <div class="gray left">起步价(含五公里内):</div>
        <div class="right"><label class="red mr5">68.0</label>元</div>
    </div>
    <div class="oneitem">
        <div class="gray left">超里程费(含五公里内):</div>
        <div class="right"><label class="red mr5">55</label>元</div>
    </div>
    <div class="oneitem">
        <div class="gray left">特殊需求(搬运):</div>
        <div class="right"><label class="red mr5">55</label>元</div>
    </div>
    <div class="oneitem">
        <div class="gray left">装/卸货等待费用:</div>
        <div class="right"><label class="red mr5">55</label>元</div>
    </div>
    <div class="oneitem">
        <div class="gray left">行驶途中等待费用:</div>
        <div class="right"><label class="red mr5">55</label>元</div>
    </div>
</section>
<section class="bottomarea">
    <button class="btn bottomone2btn left">上一步</button>
    <button class="btn bottomone2btn right">提交</button>
</section> -->

<input type="hidden" id="vehiclePriceId" name="vehiclePriceId" value=""/>
     <input type="hidden" id="bookDate" name="bookDate" value=""/>
     <input type="hidden" id="consignDesc" name="consignDesc" value=""/>
          <input type="hidden" id="consignName" name="consignName" value=""/>
     <input type="hidden" id="consignMobile" name="consignMobile" value=""/>
     <input type="hidden" id="callType" name="callType" value=""/>
     <input type="hidden" id="addrType" name="addrType" value=""/>
     <input type="hidden" id="waybillRquirement10" name="waybillRquirement10" value=""/>
	 <input type="hidden" id="waybillRquirement20" name="waybillRquirement20" value=""/>
	 <input type="hidden" id="waybillRquirement30" name="waybillRquirement30" value=""/>
	 
	 
	 <input type="hidden" id="startDistrictCode" name="startDistrictCode" value=""/>
	 <input type="hidden" id="startAddr" name="startAddr" value=""/>
	 <!--startPCD 起点 省市区-->
	 <input type="hidden" id="startPCD" name="startPCD" value=""/>
	 <!-- 起点经纬度 -->
	 <input type="hidden" id="startLocation" name="startLocation" value=""/>
	 
	 <input type="hidden" id="endDistrictCode" name="endDistrictCode" value=""/>
	 <input type="hidden" id="endAddr" name="endAddr" value=""/>
	 <!--startPCD  省市区-->
	 <input type="hidden" id="endPCD" name="endPCD" value=""/>
	 <!-- 终点经纬度 -->
	 <input type="hidden" id="endLocation" name="endLocation" value=""/>
	 <input type="hidden" id="vehiclePriceId" name="vehiclePriceId" value=""/>
	 
	  <!-- 第二终点参数 -->
	 
	 <input type="hidden" id="endDistrictCode1" name="endDistrictCode1" value=""/>
	 <input type="hidden" id="endAddr1" name="endAddr1" value=""/>
	 <!--startPCD  省市区-->
	 <input type="hidden" id="endPCD1" name="endPCD1" value=""/>
	 <!-- 终点经纬度 -->
	 <input type="hidden" id="endLocation1" name="endLocation1" value=""/>
	 
	 <!-- 第三终点参数 -->
	 <input type="hidden" id="endDistrictCode2" name="endDistrictCode2" value=""/>
	 <input type="hidden" id="endAddr2" name="endAddr2" value=""/>
	 <!--startPCD  省市区-->
	 <input type="hidden" id="endPCD2" name="endPCD2" value=""/>
	 <!-- 终点经纬度 -->
	 <input type="hidden" id="endLocation2" name="endLocation2" value=""/>
	 
	 
	 <input type="hidden" id="goodsRemark" name="goodsRemark" value=""/>
	 <input type="hidden" id="goodsType" name="goodsType" value=""/>
	  <input type="hidden" id="goodsTypeName" name="goodsTypeName" value=""/>
	 <input type="hidden" id="consignNum" name="consignNum" value=""/>
	 <input type="hidden" id="endAddrCount" name="endAddrCount" value=""/>
	 
	 <input type="hidden" id="planDistance" name="planDistance" value=""/>
	 <input type="hidden" id="planStartFee" name="planStartFee" value=""/>
	 <input type="hidden" id="planExceedFee" name="planExceedFee" value=""/>
	 <input type="hidden" id="planSpecialFee" name="planSpecialFee" value=""/>
	 <input type="hidden" id="planTotalFee" name="planTotalFee" value=""/>
	 <input type="hidden" id="specialFee10" name="specialFee10" value=""/>
	 <input type="hidden" id="specialFee20" name="specialFee20" value=""/>
	 <input type="hidden" id="customerUuid" name="customerUuid" />
	 
	  <input type="hidden" id="startStreet" name="startStreet" />
	 <input type="hidden" id="startCross" name="startCross" />
	 <input type="hidden" id="startDoorNo" name="startDoorNo" />
	 
	 <input type="hidden" id="endStreet" name="endStreet" />
	 <input type="hidden" id="endCross" name="endCross" />
	 <input type="hidden" id="endDoorNo" name="endDoorNo" />
	 <input type="hidden" id="acceptPersonMobile" name="acceptPersonMobile" />
	 <input type="hidden" id="acceptPersonName" name="acceptPersonName" />
	 
	  <input type="hidden" id="endStreet1" name="endStreet1" />
	 <input type="hidden" id="endCross1" name="endCross1" />
	 <input type="hidden" id="endDoorNo1" name="endDoorNo1" />
	 <input type="hidden" id="acceptPersonMobile1" name="acceptPersonMobile1" />
	 <input type="hidden" id="acceptPersonName1" name="acceptPersonName1" />
	 
	 <input type="hidden" id="endStreet2" name="endStreet2" />
	 <input type="hidden" id="endCross2" name="endCross2" />
	 <input type="hidden" id="endDoorNo2" name="endDoorNo2" />
	 <input type="hidden" id="acceptPersonMobile2" name="acceptPersonMobile2" />
	 <input type="hidden" id="acceptPersonName2" name="acceptPersonName2" />
	 
	  <input type="hidden" id="planLoadTime" name="planLoadTime" />
	 <input type="hidden" id="planUnloadTime" name="planUnloadTime" />
	 <input type="hidden" id="planLoadFee" name="planLoadFee" />
	 <input type="hidden" id="planUnloadFee" name="planUnloadFee" />
	 <input type="hidden" id="planLowSpeedTime" name="planLowSpeedTime" />
	 <input type="hidden" id="planLowSpeedFee" name="planLowSpeedFee" />
	 <input type="hidden" id="trackSubName" name="trackSubName" value=""/>
	 <input type="hidden" id="vehicleCode" name="vehicleCode" value=""/>
	 </form>
</body>
<script>
$(function (){
	 //token验证
		checkToken();
	}); 
$(function(){
	var customerUuid=getCookie("customerUuid");
	$("#customerUuid").val(customerUuid);
	cookie2Order();
	/* var LocString = String(window.document.location.href); 
	var addrType=getCookie("addrType");  */
	var endAddrCount=getCookie("endAddrCount"); 
	var callType=GetArgsFromHref("callType");
	$("#callType").val(callType);
	
	 var url = _global.serverHost +"/consignerOrder/orderFeeEstimation.htm";
     var data = $('#orderForm').serialize();
     _callAjaxRequest(url, data, callBack);

     function callBack(data) {
    	 var estimateInfo='';
    	 
    	 estimateInfo=estimateInfo+' <section class="itemgroup mt10">'
    	 +'<div class="estimateitem p15">'
    	 +' <div class="gray left">预估费用</div>'
    	 +'  <div class="right orange"><font class="bigtext">'+data.planTotalFee+'</font>元</div>'
    	 +' </div>'
    	 +'</section>';
    	 estimateInfo=estimateInfo+'<section class="sale_info">实际费用可能因实际行驶里程/等候时间等因素差异</section>';
 	
    	 estimateInfo=estimateInfo+'<section class="itemgroup mt10 p15 mb56">'
    	 +'<div class="oneitem">'
    	 +'<div class="gray left">总计行驶:</div>'
    	 +' <div class="right"><label class="mr5">'+data.planDistance +'</label>公里</div>'
    	 +'</div>';
    	 
    	 estimateInfo=estimateInfo+'<div class="oneitem">'
    	 +'<div class="gray left">起步价(含'+data.startDistance+'公里内):</div>'
    	 +'<div class="right"><label class="red mr5">'+data.planStartFee+'</label>元</div>'
    	 +'</div>';
    	 if(data.planExceedFee==undefined){ 
    		 data.planExceedFee=0;
    	 }
    	 estimateInfo=estimateInfo+' <div class="oneitem" style="display:none;">'
    	 +'<div class="gray left">超里程费(超出'+data.exceedDistance+'公里):</div>'
    	 +'<div class="right"><label class="red mr5">'+data.planExceedFee +'</label>元</div>'
    	 +'</div>';
    	 estimateInfo=estimateInfo+' <div class="oneitem">'
    	 +'<div class="gray left">超里程单价(超出'+data.exceedDistance+'公里):</div>'
    	 +'<div class="right"><label class="red mr5">'+data.overPrice +'</label>元/公里</div>'
    	 +'</div>';
    	 var ln_planWaitTime=data.planLoadTime-10+data.planLowSpeedTime+data.planUnloadTime;
    	 estimateInfo=estimateInfo+'<div class="oneitem">'
    	 +'<div class="gray left">预计等候时间:</div>'
    	 +'<div class="right"><label class="mr5">'+Number(ln_planWaitTime*60).formatTime()+'</label></div>'
    	 +'</div>';
    	 if(data.specialFee10!=undefined){
    	 estimateInfo=estimateInfo+'<div class="oneitem">'
    	 +'<div class="gray left">特殊需求(搬运):</div>'
 	       +'<div class="right"><label class="red mr5">'+data.specialFee10+'</label>元</div>'
 	      +'</div>';
    	 }
    	/*  if(data.specialFee20!=undefined){
 	     estimateInfo=estimateInfo+'<div class="oneitem">'
	 	    +'<div class="gray left">装/卸货等待费用:</div>'
	 	  	+'<div class="right"><label class="red mr5">'+data.specialFee20 +'</label>元</div>'
	 	 	+'</div>';
    	 } */
    	 
    	 estimateInfo=estimateInfo+' <div class="oneitem" style="display:none;">'
    	 +' <div class="gray left">装/卸货等待费用:</div>'
    	 +'<div class="right"><label class="red mr5">'+(data.planLoadFee*1+data.planUnloadFee*1)+'</label>元</div>'
    	 +'</div>';
    	 
    	 
	 	 estimateInfo=estimateInfo+'<div class="oneitem" style="display:none;">'
	 	+'<div class="gray left">行驶途中等待费用:</div>'
	 	+'<div class="right"><label class="red mr5">'+(data.planLowSpeedFee*1)+'</label>元</div>'
	 	+'</div>'
	 	+'</section>';
	 	estimateInfo=estimateInfo+'<section class="bottomarea">'
	 	+' <button class="btn bottomone2btn left" type="button" onclick="goback()">上一步</button>'
	 	+' <button class="btn bottomone2btn right" type="button" onclick="save()" id="tijiao">提交</button>'
	 	+'</section>';
    	 
    	 $("#estimateInfo").html(estimateInfo);
    	 
    		 $("#planDistance").val(data.planDistance);
    		 $("#planStartFee").val(data.planStartFee);
    		 $("#planExceedFee").val(data.planExceedFee);
    		 $("#planSpecialFee").val(data.planSpecialFee);
    		 $("#planTotalFee").val(data.planTotalFee);
    		 $("#specialFee10").val(data.specialFee10);
    		 $("#specialFee20").val(data.specialFee20);
    		 
    		 $("#planLoadTime").val(data.planLoadTime);
    		 $("#planUnloadTime").val(data.planUnloadTime);
    		 $("#planLoadFee").val(data.planLoadFee);
    		 $("#planUnloadFee").val(data.planUnloadFee);
    		 $("#planLowSpeedTime").val(data.planLowSpeedTime);
    		 $("#planLowSpeedFee").val(data.planLowSpeedFee);
     }
});

function goback()
{
	 var callType=$("#callType").val();
	 if(callType=='NOW'){
		  window.location.href="../"+_global.custNowOrderUrl;
	  }else{
		  window.location.href="../"+_global.custBookOrderUrl;
	  }
}
function save() {
	$("#tijiao").attr("disabled", true);
	$("#tijiao").css("background-color", "#ccc");
    $.ajax({
        type:'POST',
        url: _global.serverHost +'/consignerOrder/saveOrder.htm',
        data: $('#orderForm').serialize(),
        contentType:"application/x-www-form-urlencoded;charset=UTF-8",
        success: function (data) {
        	
        	if(data.outResult=='1'){
        		//window.location.href="${pageContext.request.contextPath}/consignerOrder/waitOrder.htm?waybillId="+data.waybillId;
        		 window.location.href="../"+_global.waitOrderUrl +"?waybillId="+data.waybillId;
        	}else{
        		alert(data.outResultReason);
        	}
        }
    });
}

</script>
</html>